// 数据匹配
export function dynamicText(value, options) {
  if (!value) return ''
  if (Array.isArray(value)) {
    if (!options || !Array.isArray(options)) return value.join()
    let textList = []
    for (let i = 0; i < value.length; i++) {
      let item = options.filter(o => o.id == value[i])[0]
      if (!item || !item.fullName) {
        textList.push(value[i])
      } else {
        textList.push(item.fullName)
      }
    }
    return textList.join()
  }
  if (!options || !Array.isArray(options)) return value
  let item = options.filter(o => o.id == value)[0]
  if (!item || !item.fullName) return value
  return item.fullName
}

// 枚举用户类型
export function enumUserType(val) {
  switch (val) {
    case "00":
      return "系统用户";
    case "01":
      return "消防技术服务机构";
    case "02":
      return "委托单位";
    case "03":
      return "一级消防注册工程师";
    case "04":
      return "消防设施操作员";
    case "05":
      return "平台维修员";
    default:
      return "--";
  }
};